package dyyx;

import java.util.Date;
import java.util.List;

import redis.clients.jedis.Jedis;

public class LatestNListTest {
	

	
	
	
	public static void main(String[] args) throws Exception {
		
		System.out.println("hello,LatestNListTest");
		Jedis jedis = new Jedis("127.0.0.1");
		System.out.println(jedis.info());
		
		
		String key = "LatestNListTestKey";
		Date now = new Date();
		int size = 3;
		
		// Add the string value to the head (LPUSH) or tail (RPUSH) of the list stored at key.
		
		jedis.lpush(key, now+"");
		jedis.ltrim(key, 0, size);
		
		List<String> list = jedis.lrange(key, 0, size);
		
		System.out.println(list);
		
		// 历史数据回写 使用 RPUSH 尾部 insert
			
		
		jedis.close();
		
	
	}	
	
}
